Install Qt Designer on Windows or Mac.
Tiny download: Only 40MB!
Many people want to use Qt Designer without having to download gigabytes of other software. Here are small, standalone installers of Qt Designer for Windows and Mac:
Qt Designer is a tool for quickly building graphical user interfaces with widgets from the Qt GUI framework. It gives you a simple drag-and-drop interface for laying out components such as buttons, text fields, combo boxes and more. Here is a screenshot of Qt Designer on Windows:
Qt Designer produces .ui
files. This is a
special XML-based format that stores your widgets as a tree.
You can either load these files at runtime, or have them
translated to a programming language such as C++ or Python.
Many people like to use Qt Designer together with Python because it is a very productive programming language. The easiest way to combine the two is via PyQt or PySide6. To install PyQt, simply enter the following on the command line:
python3 -m venv venv source venv/bin/activate # or "call venv\Scripts\activate.bat" on Windows python3 -m pip install PyQt6
(This assumes you have Python 3 installed.)
Suppose you have saved your file from Qt Designer as
dialog.ui
. Then you can create another file,
say main.py
, with the following contents:
from PyQt6 import uic from PyQt6.QtWidgets import QApplication Form, Window = uic.loadUiType("dialog.ui") app = QApplication([]) window = Window() form = Form() form.setupUi(window) window.show() app.exec()
When you then invoke python main.py
on the command line, the GUI you created in Designer should
open:
Once you've created an application with Qt Designer, you typically want to create an installer for it. On Windows, this is often an installation wizard in the form of an .exe:
On macOS, .dmg archives are commonly used:
We can use fbs to create such installers for applications based on Qt and Python. The free eddition of fbs supports Python 3.6 and PyQt5. Later versions require fbs Pro.
Once you've installed fbs, you can create an installer for the Python application from above as follows:
Run the command fbs startproject
. This asks you
a few questions about the name of your app etc. It creates
the directory src/main/python
. The command
fbs run
should now give you a quick preview of
the empty application created by startproject
.
Change main.py
from before to the following:
from PyQt6 import uic from PyQt6.QtWidgets import QApplication from fbs_runtime.application_context.PyQt6 import ApplicationContext Form, Window = uic.loadUiType(appctxt.get_resource("dialog.ui")) appctxt = ApplicationContext() window = Window() form = Form() form.setupUi(window) window.show() appctxt.app.exec()
Save main.py
in src/main/python
,
overwriting the existing file there.
Create the directory src/main/resources/base
.
Move dialog.ui
from above into it. When you now
do fbs run
, then you should again see the GUI
you created in Designer.
Run the command fbs freeze
. This turns your
Python (and Designer) code into a standalone executable that
can be copied to other computers.
Then execute fbs installer
. On Windows, you
need to install NSIS first and place it on your
PATH
. On Linux, you need
fpm. But
once you have these prerequisites, fbs will magically create
your installer. Congratulations!
If you want to learn more about combining Qt Designer with Python, you may be interested in my book:
It distills years of experience to quickly help you create better GUI applications. I'm humbled to say that even Phil Thompson, the creator of PyQt, read it and thinks it's "very good".
Qt Designer normally ships as a part of Qt Creator. This is Qt's official editor and lets you do a lot more than just graphically design user interfaces. It is a full-fledged and very powerful C++ IDE. This power comes at a price however: The download for Qt Creator is gigabytes in size!
This page was created for people who only need Qt Designer. The download links here contain minimal, self-contained installers of just Qt Designer that are orders of magnitude smaller. Here they are again:
Michael has been working with Qt and Python since 2016, when he started fman, a cross-platform file manager. Frustrated with the difficulties of creating a desktop app, Michael open sourced fman's build system (fbs). It saves you months when creating Python Qt GUIs. Recently, Michael also wrote a popular book about these two technologies.